package cn.kgc.vue.config;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author 课工场
 * @date 2024/4/9
 * @description  swagger接口文档工具的配置
 */
@Configuration
@EnableSwagger2
public class Swagger2WebConfig {

    @Bean
    public Docket  docket(){
        
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Java2323")   //  分组
                .apiInfo(api())   //  文档的基本信息
                .select()
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .build();
    }


    private ApiInfo api() {

        return  new ApiInfoBuilder()
                .title("Java2323前后端分离项目接口文档")
                .description("这是一个前后端分离项目,主要完成课工场相关业务的实现<br>" +
                        "前端技术栈:Vue+Element-UI+Axios<br> " +
                        "后端技术栈：<br>" +
                        "框架：springboot + mybatis-plus + shiro<br>" +
                        "数据库：mysql + redis")
                .version("1.0")
                .contact(new Contact("Java2323","http://www.java2323.com","java2323@139.com"))
                .build();
    }


}
